home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / vbcc-wos-src / pasm / predefs.c < prev    next >
Text File  |  1999-01-01  |  25KB  |  514 lines

  1. /* $VER: pasm predefs.c V1.2 (21.10.98)
  2.  *
  3.  * This file is part of pasm, a portable PowerPC assembler.
  4.  * Copyright (c) 1997-98  Frank Wille
  5.  *
  6.  * pasm is freeware and part of the portable and retargetable ANSI C
  7.  * compiler vbcc, copyright (c) 1995-98 by Volker Barthelmann.
  8.  * pasm may be freely redistributed as long as no modifications are
  9.  * made and nothing is charged for it. Non-commercial usage is allowed
  10.  * without any restrictions.
  11.  * EVERY PRODUCT OR PROGRAM DERIVED DIRECTLY FROM MY SOURCE MAY NOT BE
  12.  * SOLD COMMERCIALLY WITHOUT PERMISSION FROM THE AUTHOR.
  13.  *
  14.  *
  15.  * v1.2   (21.10.98) phx
  16.  *        Predefining some more sections:
  17.  *        .sdata, .sdata2, .sbss, .init, .fini
  18.  *        Increased aligment constraints to 16-bytes (SVR4/EABI).
  19.  * v0.7   (21.11.97) phx
  20.  *        Missing extended mnemonics: mr. and not.
  21.  *        Fixed out of range warnings in extrwi, inslwi, rotwri and srwi.
  22.  * v0.6   (26.10.97) phx
  23.  *        @object and @function were removed from stdsets. They are
  24.  *        always defined during assembler initialization (pass.c).
  25.  * v0.4   (29.04.97) phx
  26.  *        Renamed .toc into .tocd.
  27.  *        Base relative addressing mode defaults to .baserel .tocd,2
  28.  * v0.2   (24.03.97) phx
  29.  *        Writes ELF object for 32-bit PowerPC big-endian. Either absolute
  30.  *        or ELF output format may be selected. ELF is default for all
  31.  *        currently supported platforms. PPCasm supports nine different
  32.  *        relocation types (there are much more...).
  33.  *        Compiles and works also under NetBSD/amiga (68k).
  34.  *        Changed function declaration to 'new style' in all sources
  35.  *        (to avoid problems with '...' for example).
  36.  *        Changed type of predefinition texts from character-constant
  37.  *        to character-array, to avoid bus errors on systems with
  38.  *        memory protection. 
  39.  *        .rwdata and .rdata section predefinitions deleted.
  40.  * v0.1   (11.03.97) phx
  41.  *        First test version with all PowerPC instructions and most
  42.  *        important directives. Only raw, absolute output.
  43.  *        I'm still uncertain about the sense of the sections .rodata,
  44.  *        .rdata and .rwdata (where .rodata and .rdata seem indentical
  45.  *        anyway). .toc isn't supported. .bss can't be activated by its
  46.  *        name, because there is a directive called .bss.
  47.  *        Some 64-bit extended macros are missing, e.g. for shifting.
  48.  * v0.0   (21.02.97) phx
  49.  *        File created.
  50.  */
  51.  
  52.  
  53. char stdsects[] =
  54.   ".section .text,\"crx4\"\n"
  55.   ".section .data,\"drw4\"\n"
  56.   ".section .rodata,\"dr4\"\n"
  57.   ".section .sdata,\"drw4\"\n"
  58.   ".section .sdata2,\"dr4\"\n"
  59.   ".section .bss,\"urw4\"\n"
  60.   ".section .sbss,\"urw4\"\n"
  61.   ".section .init,\"crx4\"\n"
  62.   ".section .fini,\"crx4\"\n"
  63.   ".section .tocd,\"drw4\"\n"
  64.   ".text\n"                     /* activate .text section */
  65.   ".baserel .tocd,2\n";         /* default base relative mode = TOC */
  66.  
  67.  
  68. char stdsets[] =
  69.   ".set r0,0\n.set r1,1\n.set r2,2\n.set r3,3\n"
  70.   ".set r4,4\n.set r5,5\n.set r6,6\n.set r7,7\n"
  71.   ".set r8,8\n.set r9,9\n.set r10,10\n.set r11,11\n"
  72.   ".set r12,12\n.set r13,13\n.set r14,14\n.set r15,15\n"
  73.   ".set r16,16\n.set r17,17\n.set r18,18\n.set r19,19\n"
  74.   ".set r20,20\n.set r21,21\n.set r22,22\n.set r23,23\n"
  75.   ".set r24,24\n.set r25,25\n.set r26,26\n.set r27,27\n"
  76.   ".set r28,28\n.set r29,29\n.set r30,30\n.set r31,31\n"
  77.   ".set f0,0\n.set f1,1\n.set f2,2\n.set f3,3\n"
  78.   ".set f4,4\n.set f5,5\n.set f6,6\n.set f7,7\n"
  79.   ".set f8,8\n.set f9,9\n.set f10,10\n.set f11,11\n"
  80.   ".set f12,12\n.set f13,13\n.set f14,14\n.set f15,15\n"
  81.   ".set f16,16\n.set f17,17\n.set f18,18\n.set f19,19\n"
  82.   ".set f20,20\n.set f21,21\n.set f22,22\n.set f23,23\n"
  83.   ".set f24,24\n.set f25,25\n.set f26,26\n.set f27,27\n"
  84.   ".set f28,28\n.set f29,29\n.set f30,30\n.set f31,31\n"
  85.   ".set cr0,0\n.set cr1,1\n.set cr2,2\n.set cr3,3\n"
  86.   ".set cr4,4\n.set cr5,5\n.set cr6,6\n.set cr7,7\n"
  87.   ".set lt,0\n.set gt,1\n.set eq,2\n.set so,3\n.set un,3\n"
  88.   ".set sp,1\n.set rtoc,2\n.set fp,31\n.set fpscr,0\n"
  89.   ".set xer,1\n.set lr,8\n.set ctr,9\n";
  90.  
  91.  
  92. char *xmnemos[] = {
  93.   ".macro subi\n addi \\1,\\2,-(\\3)\n.endm\n",
  94.   ".macro subis\n addis \\1,\\2,-(\\3)\n.endm\n",
  95.   ".macro subic\n addic \\1,\\2,-(\\3)\n.endm\n",
  96.   ".macro subic.\n addic. \\1,\\2,-(\\3)\n.endm\n",
  97.   ".macro sub\n subf \\1,\\3,\\2\n.endm\n",
  98.   ".macro sub.\n subf. \\1,\\3,\\2\n.endm\n",
  99.   ".macro subo\n subfo \\1,\\3,\\2\n.endm\n",
  100.   ".macro subo.\n subfo. \\1,\\3,\\2\n.endm\n",
  101.   ".macro subc\n subfc \\1,\\3,\\2\n.endm\n",
  102.   ".macro subc.\n subfc. \\1,\\3,\\2\n.endm\n",
  103.   ".macro subco\n subfco \\1,\\3,\\2\n.endm\n",
  104.   ".macro subco.\n subfco. \\1,\\3,\\2\n.endm\n",
  105.  
  106.   ".macro cmpwi\n.ifeq $NARG-2\n cmpi 0,0,\\1,\\2\n"
  107.           ".else\n cmpi \\1,0,\\2,\\3\n.endif\n.endm\n",
  108.   ".macro cmpw\n.ifeq $NARG-2\n cmp 0,0,\\1,\\2\n"
  109.           ".else\n cmp \\1,0,\\2,\\3\n.endif\n.endm\n",
  110.   ".macro cmplwi\n.ifeq $NARG-2\n cmpli 0,0,\\1,\\2\n"
  111.           ".else\n cmpli \\1,0,\\2,\\3\n.endif\n.endm\n",
  112.   ".macro cmplw\n.ifeq $NARG-2\n cmpl 0,0,\\1,\\2\n"
  113.           ".else\n cmpl \\1,0,\\2,\\3\n.endif\n.endm\n",
  114.   ".macro cmpdi\n.ifeq $NARG-2\n cmpi 0,1,\\1,\\2\n"
  115.           ".else\n cmpi \\1,1,\\2,\\3\n.endif\n.endm\n",
  116.   ".macro cmpd\n.ifeq $NARG-2\n cmp 0,1,\\1,\\2\n"
  117.           ".else\n cmp \\1,1,\\2,\\3\n.endif\n.endm\n",
  118.   ".macro cmpldi\n.ifeq $NARG-2\n cmpli 0,1,\\1,\\2\n"
  119.           ".else\n cmpli \\1,1,\\2,\\3\n.endif\n.endm\n",
  120.   ".macro cmpld\n.ifeq $NARG-2\n cmpl 0,1,\\1,\\2\n"
  121.           ".else\n cmpl \\1,1,\\2,\\3\n.endif\n.endm\n",
  122.  
  123.   ".macro extlwi\n rlwinm \\1,\\2,\\4,0,(\\3)-1\n.endm\n",
  124.   ".macro extlwi.\n rlwinm. \\1,\\2,\\4,0,(\\3)-1\n.endm\n",
  125.   ".macro extrwi\n rlwinm \\1,\\2,((\\4)+(\\3))&31,32-(\\3),31\n.endm\n",
  126.   ".macro extrwi.\n rlwinm. \\1,\\2,((\\4)+(\\3))&31,32-(\\3),31\n.endm\n",
  127.   ".macro inslwi\n rlwimi \\1,\\2,(32-(\\4))&31,\\4,((\\4)+(\\3))-1\n.endm\n",
  128.   ".macro inslwi.\n rlwimi. \\1,\\2,(32-(\\4))&31,\\4,((\\4)+(\\3))-1\n.endm\n",
  129.   ".macro insrwi\n rlwimi \\1,\\2,32-((\\4)+(\\3)),\\4,((\\4)+(\\3))-1\n.endm\n",
  130.   ".macro insrwi.\n rlwimi. \\1,\\2,32-((\\4)+(\\3)),\\4,((\\4)+(\\3))-1\n.endm\n",
  131.   ".macro rotlwi\n rlwinm \\1,\\2,\\3,0,31\n.endm\n",
  132.   ".macro rotlwi.\n rlwinm. \\1,\\2,\\3,0,31\n.endm\n",
  133.   ".macro rotrwi\n rlwinm \\1,\\2,(32-(\\3))&31,0,31\n.endm\n",
  134.   ".macro rotrwi.\n rlwinm. \\1,\\2,(32-(\\3))&31,0,31\n.endm\n",
  135.   ".macro rotlw\n rlwnm \\1,\\2,\\3,0,31\n.endm\n",
  136.   ".macro rotlw.\n rlwnm. \\1,\\2,\\3,0,31\n.endm\n",
  137.   ".macro slwi\n rlwinm \\1,\\2,\\3,0,31-(\\3)\n.endm\n",
  138.   ".macro slwi.\n rlwinm. \\1,\\2,\\3,0,31-(\\3)\n.endm\n",
  139.   ".macro srwi\n rlwinm \\1,\\2,(32-(\\3))&31,\\3,31\n.endm\n",
  140.   ".macro srwi.\n rlwinm. \\1,\\2,(32-(\\3))&31,\\3,31\n.endm\n",
  141.   ".macro clrlwi\n rlwinm \\1,\\2,0,\\3,31\n.endm\n",
  142.   ".macro clrlwi.\n rlwinm. \\1,\\2,0,\\3,31\n.endm\n",
  143.   ".macro clrrwi\n rlwinm \\1,\\2,0,0,31-(\\3)\n.endm\n",
  144.   ".macro clrrwi.\n rlwinm. \\1,\\2,0,0,31-(\\3)\n.endm\n",
  145.   ".macro clrlslwi\n rlwinm \\1,\\2,\\4,(\\3)-(\\4),31-(\\4)\n.endm\n",
  146.   ".macro clrlslwi.\n rlwinm. \\1,\\2,\\4,(\\3)-(\\4),31-(\\4)\n.endm\n",
  147.  
  148.   ".macro bt\n bc\\0 12,\\1,\\2\n.endm\n",
  149.   ".macro bf\n bc\\0 4,\\1,\\2\n.endm\n",
  150.   ".macro bdnz\n bc\\0 16,0,\\1\n.endm\n",
  151.   ".macro bdnzt\n bc\\0 8,\\1,\\2\n.endm\n",
  152.   ".macro bdnzf\n bc\\0 0,\\1,\\2\n.endm\n",
  153.   ".macro bdz\n bc\\0 18,0,\\1\n.endm\n",
  154.   ".macro bdzt\n bc\\0 10,\\1,\\2\n.endm\n",
  155.   ".macro bdzf\n bc\\0 2,\\1,\\2\n.endm\n",
  156.   ".macro bta\n bca\\0 12,\\1,\\2\n.endm\n",
  157.   ".macro bfa\n bca\\0 4,\\1,\\2\n.endm\n",
  158.   ".macro bdnza\n bca\\0 16,0,\\1\n.endm\n",
  159.   ".macro bdnzta\n bca\\0 8,\\1,\\2\n.endm\n",
  160.   ".macro bdnzfa\n bca\\0 0,\\1,\\2\n.endm\n",
  161.   ".macro bdza\n bca\\0 18,0,\\1\n.endm\n",
  162.   ".macro bdzta\n bca\\0 10,\\1,\\2\n.endm\n",
  163.   ".macro bdzfa\n bca\\0 2,\\1,\\2\n.endm\n",
  164.   ".macro blr\n bclr 20,0\n.endm\n",
  165.   ".macro btlr\n bclr\\0 12,\\1\n.endm\n",
  166.   ".macro bflr\n bclr\\0 4,\\1\n.endm\n",
  167.   ".macro bdnzlr\n bclr\\0 16,0\n.endm\n",
  168.   ".macro bdnztlr\n bclr\\0 8,\\1\n.endm\n",
  169.   ".macro bdnzflr\n bclr\\0 0,\\1\n.endm\n",
  170.   ".macro bdzlr\n bclr\\0 18,0\n.endm\n",
  171.   ".macro bdztlr\n bclr\\0 10,\\1\n.endm\n",
  172.   ".macro bdzflr\n bclr\\0 2,\\1\n.endm\n",
  173.   ".macro bctr\n bcctr 20,0\n.endm\n",
  174.   ".macro btctr\n bcctr\\0 12,\\1\n.endm\n",
  175.   ".macro bfctr\n bcctr\\0 4,\\1\n.endm\n",
  176.   ".macro btl\n bcl\\0 12,\\1,\\2\n.endm\n",
  177.   ".macro bfl\n bcl\\0 4,\\1,\\2\n.endm\n",
  178.   ".macro bdnzl\n bcl\\0 16,0,\\1\n.endm\n",
  179.   ".macro bdnztl\n bcl\\0 8,\\1,\\2\n.endm\n",
  180.   ".macro bdnzfl\n bcl\\0 0,\\1,\\2\n.endm\n",
  181.   ".macro bdzl\n bcl\\0 18,0,\\1\n.endm\n",
  182.   ".macro bdztl\n bcl\\0 10,\\1,\\2\n.endm\n",
  183.   ".macro bdzfl\n bcl\\0 2,\\1,\\2\n.endm\n",
  184.   ".macro btla\n bcla\\0 12,\\1,\\2\n.endm\n",
  185.   ".macro bfla\n bcla\\0 4,\\1,\\2\n.endm\n",
  186.   ".macro bdnzla\n bcla\\0 16,0,\\1\n.endm\n",
  187.   ".macro bdnztla\n bcla\\0 8,\\1,\\2\n.endm\n",
  188.   ".macro bdnzfla\n bcla\\0 0,\\1,\\2\n.endm\n",
  189.   ".macro bdzla\n bcla\\0 18,0,\\1\n.endm\n",
  190.   ".macro bdztla\n bcla\\0 10,\\1,\\2\n.endm\n",
  191.   ".macro bdzfla\n bcla\\0 2,\\1,\\2\n.endm\n",
  192.   ".macro blrl\n bclrl 20,0\n.endm\n",
  193.   ".macro btlrl\n bclrl\\0 12,\\1\n.endm\n",
  194.   ".macro bflrl\n bclrl\\0 4,\\1\n.endm\n",
  195.   ".macro bdnzlrl\n bclrl\\0 16,0\n.endm\n",
  196.   ".macro bdnztlrl\n bclrl\\0 8,\\1\n.endm\n",
  197.   ".macro bdnzflrl\n bclrl\\0 0,\\1\n.endm\n",
  198.   ".macro bdzlrl\n bclrl\\0 18,0\n.endm\n",
  199.   ".macro bdztlrl\n bclrl\\0 10,\\1\n.endm\n",
  200.   ".macro bdzflrl\n bclrl\\0 2,\\1\n.endm\n",
  201.   ".macro bctrl\n bcctrl 20,0\n.endm\n",
  202.   ".macro btctrl\n bcctrl\\0 12,\\1\n.endm\n",
  203.   ".macro bfctrl\n bcctrl\\0 4,\\1\n.endm\n",
  204.  
  205.   ".macro blt\n.ifeq $NARG-1\n bc\\0 12,0,\\1\n.else\n"
  206.           "bc\\0 12,4*(\\1)+0,\\2\n.endif\n.endm\n",
  207.   ".macro ble\n.ifeq $NARG-1\n bc\\0 4,1,\\1\n.else\n"
  208.           "bc\\0 4,4*(\\1)+1,\\2\n.endif\n.endm\n",
  209.   ".macro beq\n.ifeq $NARG-1\n bc\\0 12,2,\\1\n.else\n"
  210.           "bc\\0 12,4*(\\1)+2,\\2\n.endif\n.endm\n",
  211.   ".macro bge\n.ifeq $NARG-1\n bc\\0 4,0,\\1\n.else\n"
  212.           "bc\\0 4,4*(\\1)+0,\\2\n.endif\n.endm\n",
  213.   ".macro bgt\n.ifeq $NARG-1\n bc\\0 12,1,\\1\n.else\n"
  214.           "bc\\0 12,4*(\\1)+1,\\2\n.endif\n.endm\n",
  215.   ".macro bnl\n.ifeq $NARG-1\n bc\\0 4,0,\\1\n.else\n"
  216.           "bc\\0 4,4*(\\1)+0,\\2\n.endif\n.endm\n",
  217.   ".macro bne\n.ifeq $NARG-1\n bc\\0 4,2,\\1\n.else\n"
  218.           "bc\\0 4,4*(\\1)+2,\\2\n.endif\n.endm\n",
  219.   ".macro bng\n.ifeq $NARG-1\n bc\\0 4,1,\\1\n.else\n"
  220.           "bc\\0 4,4*(\\1)+1,\\2\n.endif\n.endm\n",
  221.   ".macro bso\n.ifeq $NARG-1\n bc\\0 12,3,\\1\n.else\n"
  222.           "bc\\0 12,4*(\\1)+3,\\2\n.endif\n.endm\n",
  223.   ".macro bns\n.ifeq $NARG-1\n bc\\0 4,3,\\1\n.else\n"
  224.           "bc\\0 4,4*(\\1)+3,\\2\n.endif\n.endm\n",
  225.   ".macro bun\n.ifeq $NARG-1\n bc\\0 12,3,\\1\n.else\n"
  226.           "bc\\0 12,4*(\\1)+3,\\2\n.endif\n.endm\n",
  227.   ".macro bnu\n.ifeq $NARG-1\n bc\\0 4,3,\\1\n.else\n"
  228.           "bc\\0 4,4*(\\1)+3,\\2\n.endif\n.endm\n",
  229.   ".macro blta\n.ifeq $NARG-1\n bca\\0 12,0,\\1\n.else\n"
  230.           "bca\\0 12,4*(\\1)+0,\\2\n.endif\n.endm\n",
  231.   ".macro blea\n.ifeq $NARG-1\n bca\\0 4,1,\\1\n.else\n"
  232.           "bca\\0 4,4*(\\1)+1,\\2\n.endif\n.endm\n",
  233.   ".macro beqa\n.ifeq $NARG-1\n bca\\0 12,2,\\1\n.else\n"
  234.           "bca\\0 12,4*(\\1)+2,\\2\n.endif\n.endm\n",
  235.   ".macro bgea\n.ifeq $NARG-1\n bca\\0 4,0,\\1\n.else\n"
  236.           "bca\\0 4,4*(\\1)+0,\\2\n.endif\n.endm\n",
  237.   ".macro bgta\n.ifeq $NARG-1\n bca\\0 12,1,\\1\n.else\n"
  238.           "bca\\0 12,4*(\\1)+1,\\2\n.endif\n.endm\n",
  239.   ".macro bnla\n.ifeq $NARG-1\n bca\\0 4,0,\\1\n.else\n"
  240.           "bca\\0 4,4*(\\1)+0,\\2\n.endif\n.endm\n",
  241.   ".macro bnea\n.ifeq $NARG-1\n bca\\0 4,2,\\1\n.else\n"
  242.           "bca\\0 4,4*(\\1)+2,\\2\n.endif\n.endm\n",
  243.   ".macro bnga\n.ifeq $NARG-1\n bca\\0 4,1,\\1\n.else\n"
  244.           "bca\\0 4,4*(\\1)+1,\\2\n.endif\n.endm\n",
  245.   ".macro bsoa\n.ifeq $NARG-1\n bca\\0 12,3,\\1\n.else\n"
  246.           "bca\\0 12,4*(\\1)+3,\\2\n.endif\n.endm\n",
  247.   ".macro bnsa\n.ifeq $NARG-1\n bca\\0 4,3,\\1\n.else\n"
  248.           "bca\\0 4,4*(\\1)+3,\\2\n.endif\n.endm\n",
  249.   ".macro buna\n.ifeq $NARG-1\n bca\\0 12,3,\\1\n.else\n"
  250.           "bca\\0 12,4*(\\1)+3,\\2\n.endif\n.endm\n",
  251.   ".macro bnua\n.ifeq $NARG-1\n bca\\0 4,3,\\1\n.else\n"
  252.           "bca\\0 4,4*(\\1)+3,\\2\n.endif\n.endm\n",
  253.  
  254.   ".macro bltlr\n.ifeq $NARG-1\n bclr\\0 12,4*(\\1)+0\n"
  255.           ".else\n bclr\\0 12,0\n.endif\n.endm\n",
  256.   ".macro blelr\n.ifeq $NARG-1\n bclr\\0 4,4*(\\1)+1\n"
  257.           ".else\n bclr\\0 4,1\n.endif\n.endm\n",
  258.   ".macro beqlr\n.ifeq $NARG-1\n bclr\\0 12,4*(\\1)+2\n"
  259.           ".else\n bclr\\0 12,2\n.endif\n.endm\n",
  260.   ".macro bgelr\n.ifeq $NARG-1\n bclr\\0 4,4*(\\1)+0\n"
  261.           ".else\n bclr\\0 4,0\n.endif\n.endm\n",
  262.   ".macro bgtlr\n.ifeq $NARG-1\n bclr\\0 12,4*(\\1)+1\n"
  263.           ".else\n bclr\\0 12,1\n.endif\n.endm\n",
  264.   ".macro bnllr\n.ifeq $NARG-1\n bclr\\0 4,4*(\\1)+0\n"
  265.           ".else\n bclr\\0 4,0\n.endif\n.endm\n",
  266.   ".macro bnelr\n.ifeq $NARG-1\n bclr\\0 4,4*(\\1)+2\n"
  267.           ".else\n bclr\\0 4,2\n.endif\n.endm\n",
  268.   ".macro bnglr\n.ifeq $NARG-1\n bclr\\0 4,4*(\\1)+1\n"
  269.           ".else\n bclr\\0 4,1\n.endif\n.endm\n",
  270.   ".macro bsolr\n.ifeq $NARG-1\n bclr\\0 12,4*(\\1)+3\n"
  271.           ".else\n bclr\\0 12,3\n.endif\n.endm\n",
  272.   ".macro bnslr\n.ifeq $NARG-1\n bclr\\0 4,4*(\\1)+3\n"
  273.           ".else\n bclr\\0 4,3\n.endif\n.endm\n",
  274.   ".macro bunlr\n.ifeq $NARG-1\n bclr\\0 12,4*(\\1)+3\n"
  275.           ".else\n bclr\\0 12,3\n.endif\n.endm\n",
  276.   ".macro bnulr\n.ifeq $NARG-1\n bclr\\0 4,4*(\\1)+3\n"
  277.           ".else\n bclr\\0 4,3\n.endif\n.endm\n",
  278.   ".macro bltctr\n.ifeq $NARG-1\n bcctr\\0 12,4*(\\1)+0\n"
  279.           ".else\n bcctr\\0 12,0\n.endif\n.endm\n",
  280.   ".macro blectr\n.ifeq $NARG-1\n bcctr\\0 4,4*(\\1)+1\n"
  281.           ".else\n bcctr\\0 4,1\n.endif\n.endm\n",
  282.   ".macro beqctr\n.ifeq $NARG-1\n bcctr\\0 12,4*(\\1)+2\n"
  283.           ".else\n bcctr\\0 12,2\n.endif\n.endm\n",
  284.   ".macro bgectr\n.ifeq $NARG-1\n bcctr\\0 4,4*(\\1)+0\n"
  285.           ".else\n bcctr\\0 4,0\n.endif\n.endm\n",
  286.   ".macro bgtctr\n.ifeq $NARG-1\n bcctr\\0 12,4*(\\1)+1\n"
  287.           ".else\n bcctr\\0 12,1\n.endif\n.endm\n",
  288.   ".macro bnlctr\n.ifeq $NARG-1\n bcctr\\0 4,4*(\\1)+0\n"
  289.           ".else\n bcctr\\0 4,0\n.endif\n.endm\n",
  290.   ".macro bnectr\n.ifeq $NARG-1\n bcctr\\0 4,4*(\\1)+2\n"
  291.           ".else\n bcctr\\0 4,2\n.endif\n.endm\n",
  292.   ".macro bngctr\n.ifeq $NARG-1\n bcctr\\0 4,4*(\\1)+1\n"
  293.           ".else\n bcctr\\0 4,1\n.endif\n.endm\n",
  294.   ".macro bsoctr\n.ifeq $NARG-1\n bcctr\\0 12,4*(\\1)+3\n"
  295.           ".else\n bcctr\\0 12,3\n.endif\n.endm\n",
  296.   ".macro bnsctr\n.ifeq $NARG-1\n bcctr\\0 4,4*(\\1)+3\n"
  297.           ".else\n bcctr\\0 4,3\n.endif\n.endm\n",
  298.   ".macro bunctr\n.ifeq $NARG-1\n bcctr\\0 12,4*(\\1)+3\n"
  299.           ".else\n bcctr\\0 12,3\n.endif\n.endm\n",
  300.   ".macro bnuctr\n.ifeq $NARG-1\n bcctr\\0 4,4*(\\1)+3\n"
  301.           ".else\n bcctr\\0 4,3\n.endif\n.endm\n",
  302.  
  303.   ".macro bltl\n.ifeq $NARG-1\n bcl\\0 12,0,\\1\n.else\n"
  304.           "bcl\\0 12,4*(\\1)+0,\\2\n.endif\n.endm\n",
  305.   ".macro blel\n.ifeq $NARG-1\n bcl\\0 4,1,\\1\n.else\n"
  306.           "bcl\\0 4,4*(\\1)+1,\\2\n.endif\n.endm\n",
  307.   ".macro beql\n.ifeq $NARG-1\n bcl\\0 12,2,\\1\n.else\n"
  308.           "bcl\\0 12,4*(\\1)+2,\\2\n.endif\n.endm\n",
  309.   ".macro bgel\n.ifeq $NARG-1\n bcl\\0 4,0,\\1\n.else\n"
  310.           "bcl\\0 4,4*(\\1)+0,\\2\n.endif\n.endm\n",
  311.   ".macro bgtl\n.ifeq $NARG-1\n bcl\\0 12,1,\\1\n.else\n"
  312.           "bcl\\0 12,4*(\\1)+1,\\2\n.endif\n.endm\n",
  313.   ".macro bnll\n.ifeq $NARG-1\n bcl\\0 4,0,\\1\n.else\n"
  314.           "bcl\\0 4,4*(\\1)+0,\\2\n.endif\n.endm\n",
  315.   ".macro bnel\n.ifeq $NARG-1\n bcl\\0 4,2,\\1\n.else\n"
  316.           "bcl\\0 4,4*(\\1)+2,\\2\n.endif\n.endm\n",
  317.   ".macro bngl\n.ifeq $NARG-1\n bcl\\0 4,1,\\1\n.else\n"
  318.           "bcl\\0 4,4*(\\1)+1,\\2\n.endif\n.endm\n",
  319.   ".macro bsol\n.ifeq $NARG-1\n bcl\\0 12,3,\\1\n.else\n"
  320.           "bcl\\0 12,4*(\\1)+3,\\2\n.endif\n.endm\n",
  321.   ".macro bnsl\n.ifeq $NARG-1\n bcl\\0 4,3,\\1\n.else\n"
  322.           "bcl\\0 4,4*(\\1)+3,\\2\n.endif\n.endm\n",
  323.   ".macro bunl\n.ifeq $NARG-1\n bcl\\0 12,3,\\1\n.else\n"
  324.           "bcl\\0 12,4*(\\1)+3,\\2\n.endif\n.endm\n",
  325.   ".macro bnul\n.ifeq $NARG-1\n bcl\\0 4,3,\\1\n.else\n"
  326.           "bcl\\0 4,4*(\\1)+3,\\2\n.endif\n.endm\n",
  327.   ".macro bltla\n.ifeq $NARG-1\n bcla\\0 12,0,\\1\n.else\n"
  328.           "bcla\\0 12,4*(\\1)+0,\\2\n.endif\n.endm\n",
  329.   ".macro blela\n.ifeq $NARG-1\n bcla\\0 4,1,\\1\n.else\n"
  330.           "bcla\\0 4,4*(\\1)+1,\\2\n.endif\n.endm\n",
  331.   ".macro beqla\n.ifeq $NARG-1\n bcla\\0 12,2,\\1\n.else\n"
  332.           "bcla\\0 12,4*(\\1)+2,\\2\n.endif\n.endm\n",
  333.   ".macro bgela\n.ifeq $NARG-1\n bcla\\0 4,0,\\1\n.else\n"
  334.           "bcla\\0 4,4*(\\1)+0,\\2\n.endif\n.endm\n",
  335.   ".macro bgtla\n.ifeq $NARG-1\n bcla\\0 12,1,\\1\n.else\n"
  336.           "bcla\\0 12,4*(\\1)+1,\\2\n.endif\n.endm\n",
  337.   ".macro bnlla\n.ifeq $NARG-1\n bcla\\0 4,0,\\1\n.else\n"
  338.           "bcla\\0 4,4*(\\1)+0,\\2\n.endif\n.endm\n",
  339.   ".macro bnela\n.ifeq $NARG-1\n bcla\\0 4,2,\\1\n.else\n"
  340.           "bcla\\0 4,4*(\\1)+2,\\2\n.endif\n.endm\n",
  341.   ".macro bngla\n.ifeq $NARG-1\n bcla\\0 4,1,\\1\n.else\n"
  342.           "bcla\\0 4,4*(\\1)+1,\\2\n.endif\n.endm\n",
  343.   ".macro bsola\n.ifeq $NARG-1\n bcla\\0 12,3,\\1\n.else\n"
  344.           "bcla\\0 12,4*(\\1)+3,\\2\n.endif\n.endm\n",
  345.   ".macro bnsla\n.ifeq $NARG-1\n bcla\\0 4,3,\\1\n.else\n"
  346.           "bcla\\0 4,4*(\\1)+3,\\2\n.endif\n.endm\n",
  347.   ".macro bunla\n.ifeq $NARG-1\n bcla\\0 12,3,\\1\n.else\n"
  348.           "bcla\\0 12,4*(\\1)+3,\\2\n.endif\n.endm\n",
  349.   ".macro bnula\n.ifeq $NARG-1\n bcla\\0 4,3,\\1\n.else\n"
  350.           "bcla\\0 4,4*(\\1)+3,\\2\n.endif\n.endm\n",
  351.  
  352.   ".macro bltlrl\n.ifeq $NARG-1\n bclrl\\0 12,4*(\\1)+0\n"
  353.           ".else\n bclrl\\0 12,0\n.endif\n.endm\n",
  354.   ".macro blelrl\n.ifeq $NARG-1\n bclrl\\0 4,4*(\\1)+1\n"
  355.           ".else\n bclrl\\0 4,1\n.endif\n.endm\n",
  356.   ".macro beqlrl\n.ifeq $NARG-1\n bclrl\\0 12,4*(\\1)+2\n"
  357.           ".else\n bclrl\\0 12,2\n.endif\n.endm\n",
  358.   ".macro bgelrl\n.ifeq $NARG-1\n bclrl\\0 4,4*(\\1)+0\n"
  359.           ".else\n bclrl\\0 4,0\n.endif\n.endm\n",
  360.   ".macro bgtlrl\n.ifeq $NARG-1\n bclrl\\0 12,4*(\\1)+1\n"
  361.           ".else\n bclrl\\0 12,1\n.endif\n.endm\n",
  362.   ".macro bnllrl\n.ifeq $NARG-1\n bclrl\\0 4,4*(\\1)+0\n"
  363.           ".else\n bclrl\\0 4,0\n.endif\n.endm\n",
  364.   ".macro bnelrl\n.ifeq $NARG-1\n bclrl\\0 4,4*(\\1)+2\n"
  365.           ".else\n bclrl\\0 4,2\n.endif\n.endm\n",
  366.   ".macro bnglrl\n.ifeq $NARG-1\n bclrl\\0 4,4*(\\1)+1\n"
  367.           ".else\n bclrl\\0 4,1\n.endif\n.endm\n",
  368.   ".macro bsolrl\n.ifeq $NARG-1\n bclrl\\0 12,4*(\\1)+3\n"
  369.           ".else\n bclrl\\0 12,3\n.endif\n.endm\n",
  370.   ".macro bnslrl\n.ifeq $NARG-1\n bclrl\\0 4,4*(\\1)+3\n"
  371.           ".else\n bclrl\\0 4,3\n.endif\n.endm\n",
  372.   ".macro bunlrl\n.ifeq $NARG-1\n bclrl\\0 12,4*(\\1)+3\n"
  373.           ".else\n bclrl\\0 12,3\n.endif\n.endm\n",
  374.   ".macro bnulrl\n.ifeq $NARG-1\n bclrl\\0 4,4*(\\1)+3\n"
  375.           ".else\n bclrl\\0 4,3\n.endif\n.endm\n",
  376.   ".macro bltctrl\n.ifeq $NARG-1\n bcctrl\\0 12,4*(\\1)+0\n"
  377.           ".else\n bcctrl\\0 12,0\n.endif\n.endm\n",
  378.   ".macro blectrl\n.ifeq $NARG-1\n bcctrl\\0 4,4*(\\1)+1\n"
  379.           ".else\n bcctrl\\0 4,1\n.endif\n.endm\n",
  380.   ".macro beqctrl\n.ifeq $NARG-1\n bcctrl\\0 12,4*(\\1)+2\n"
  381.           ".else\n bcctrl\\0 12,2\n.endif\n.endm\n",
  382.   ".macro bgectrl\n.ifeq $NARG-1\n bcctrl\\0 4,4*(\\1)+0\n"
  383.           ".else\n bcctrl\\0 4,0\n.endif\n.endm\n",
  384.   ".macro bgtctrl\n.ifeq $NARG-1\n bcctrl\\0 12,4*(\\1)+1\n"
  385.           ".else\n bcctrl\\0 12,1\n.endif\n.endm\n",
  386.   ".macro bnlctrl\n.ifeq $NARG-1\n bcctrl\\0 4,4*(\\1)+0\n"
  387.           ".else\n bcctrl\\0 4,0\n.endif\n.endm\n",
  388.   ".macro bnectrl\n.ifeq $NARG-1\n bcctrl\\0 4,4*(\\1)+2\n"
  389.           ".else\n bcctrl\\0 4,2\n.endif\n.endm\n",
  390.   ".macro bngctrl\n.ifeq $NARG-1\n bcctrl\\0 4,4*(\\1)+1\n"
  391.           ".else\n bcctrl\\0 4,1\n.endif\n.endm\n",
  392.   ".macro bsoctrl\n.ifeq $NARG-1\n bcctrl\\0 12,4*(\\1)+3\n"
  393.           ".else\n bcctrl\\0 12,3\n.endif\n.endm\n",
  394.   ".macro bnsctrl\n.ifeq $NARG-1\n bcctrl\\0 4,4*(\\1)+3\n"
  395.           ".else\n bcctrl\\0 4,3\n.endif\n.endm\n",
  396.   ".macro bunctrl\n.ifeq $NARG-1\n bcctrl\\0 12,4*(\\1)+3\n"
  397.           ".else\n bcctrl\\0 12,3\n.endif\n.endm\n",
  398.   ".macro bnuctrl\n.ifeq $NARG-1\n bcctrl\\0 4,4*(\\1)+3\n"
  399.           ".else\n bcctrl\\0 4,3\n.endif\n.endm\n",
  400.  
  401.   ".macro crset\n creqv \\1,\\1,\\1\n.endm\n",
  402.   ".macro crclr\n crxor \\1,\\1,\\1\n.endm\n",
  403.   ".macro crmove\n cror \\1,\\2,\\2\n.endm\n",
  404.   ".macro crnot\n crnor \\1,\\2,\\2\n.endm\n",
  405.  
  406.   ".macro trap\n tw 31,0,0\n.endm\n",
  407.   ".macro twlt\n tw 16,\\1,\\2\n.endm\n",
  408.   ".macro twle\n tw 20,\\1,\\2\n.endm\n",
  409.   ".macro tweq\n tw 4,\\1,\\2\n.endm\n",
  410.   ".macro twge\n tw 12,\\1,\\2\n.endm\n",
  411.   ".macro twgt\n tw 8,\\1,\\2\n.endm\n",
  412.   ".macro twnl\n tw 12,\\1,\\2\n.endm\n",
  413.   ".macro twne\n tw 24,\\1,\\2\n.endm\n",
  414.   ".macro twng\n tw 20,\\1,\\2\n.endm\n",
  415.   ".macro twllt\n tw 2,\\1,\\2\n.endm\n",
  416.   ".macro twlle\n tw 6,\\1,\\2\n.endm\n",
  417.   ".macro twlge\n tw 5,\\1,\\2\n.endm\n",
  418.   ".macro twlgt\n tw 1,\\1,\\2\n.endm\n",
  419.   ".macro twlnl\n tw 5,\\1,\\2\n.endm\n",
  420.   ".macro twlng\n tw 6,\\1,\\2\n.endm\n",
  421.   ".macro twlti\n twi 16,\\1,\\2\n.endm\n",
  422.   ".macro twlei\n twi 20,\\1,\\2\n.endm\n",
  423.   ".macro tweqi\n twi 4,\\1,\\2\n.endm\n",
  424.   ".macro twgei\n twi 12,\\1,\\2\n.endm\n",
  425.   ".macro twgti\n twi 8,\\1,\\2\n.endm\n",
  426.   ".macro twnli\n twi 12,\\1,\\2\n.endm\n",
  427.   ".macro twnei\n twi 24,\\1,\\2\n.endm\n",
  428.   ".macro twngi\n twi 20,\\1,\\2\n.endm\n",
  429.   ".macro twllti\n twi 2,\\1,\\2\n.endm\n",
  430.   ".macro twllei\n twi 6,\\1,\\2\n.endm\n",
  431.   ".macro twlgei\n twi 5,\\1,\\2\n.endm\n",
  432.   ".macro twlgti\n twi 1,\\1,\\2\n.endm\n",
  433.   ".macro twlnli\n twi 5,\\1,\\2\n.endm\n",
  434.   ".macro twlngi\n twi 6,\\1,\\2\n.endm\n",
  435.   ".macro tdlt\n td 16,\\1,\\2\n.endm\n",
  436.   ".macro tdle\n td 20,\\1,\\2\n.endm\n",
  437.   ".macro tdeq\n td 4,\\1,\\2\n.endm\n",
  438.   ".macro tdge\n td 12,\\1,\\2\n.endm\n",
  439.   ".macro tdgt\n td 8,\\1,\\2\n.endm\n",
  440.   ".macro tdnl\n td 12,\\1,\\2\n.endm\n",
  441.   ".macro tdne\n td 24,\\1,\\2\n.endm\n",
  442.   ".macro tdng\n td 20,\\1,\\2\n.endm\n",
  443.   ".macro tdllt\n td 2,\\1,\\2\n.endm\n",
  444.   ".macro tdlle\n td 6,\\1,\\2\n.endm\n",
  445.   ".macro tdlge\n td 5,\\1,\\2\n.endm\n",
  446.   ".macro tdlgt\n td 1,\\1,\\2\n.endm\n",
  447.   ".macro tdlnl\n td 5,\\1,\\2\n.endm\n",
  448.   ".macro tdlng\n td 6,\\1,\\2\n.endm\n",
  449.   ".macro tdlti\n tdi 16,\\1,\\2\n.endm\n",
  450.   ".macro tdlei\n tdi 20,\\1,\\2\n.endm\n",
  451.   ".macro tdeqi\n tdi 4,\\1,\\2\n.endm\n",
  452.   ".macro tdgei\n tdi 12,\\1,\\2\n.endm\n",
  453.   ".macro tdgti\n tdi 8,\\1,\\2\n.endm\n",
  454.   ".macro tdnli\n tdi 12,\\1,\\2\n.endm\n",
  455.   ".macro tdnei\n tdi 24,\\1,\\2\n.endm\n",
  456.   ".macro tdngi\n tdi 20,\\1,\\2\n.endm\n",
  457.   ".macro tdllti\n tdi 2,\\1,\\2\n.endm\n",
  458.   ".macro tdllei\n tdi 6,\\1,\\2\n.endm\n",
  459.   ".macro tdlgei\n tdi 5,\\1,\\2\n.endm\n",
  460.   ".macro tdlgti\n tdi 1,\\1,\\2\n.endm\n",
  461.   ".macro tdlnli\n tdi 5,\\1,\\2\n.endm\n",
  462.   ".macro tdlngi\n tdi 6,\\1,\\2\n.endm\n",
  463.  
  464.   ".macro mtxer\n mtspr 1,\\1\n.endm\n",
  465.   ".macro mtlr\n mtspr 8,\\1\n.endm\n",
  466.   ".macro mtctr\n mtspr 9,\\1\n.endm\n",
  467.   ".macro mtdsisr\n mtspr 18,\\1\n.endm\n",
  468.   ".macro mtdar\n mtspr 19,\\1\n.endm\n",
  469.   ".macro mtdec\n mtspr 22,\\1\n.endm\n",
  470.   ".macro mtsdr1\n mtspr 25,\\1\n.endm\n",
  471.   ".macro mtsrr0\n mtspr 26,\\1\n.endm\n",
  472.   ".macro mtsrr1\n mtspr 27,\\1\n.endm\n",
  473.   ".macro mtsprg\n mtspr 272+(\\1),\\2\n.endm\n",
  474.   ".macro mtasr\n mtspr 280,\\1\n.endm\n",
  475.   ".macro mtear\n mtspr 282,\\1\n.endm\n",
  476.   ".macro mttbl\n mtspr 284,\\1\n.endm\n",
  477.   ".macro mttbu\n mtspr 285,\\1\n.endm\n",
  478.   ".macro mtibatu\n mtspr 528+2*(\\1),\\2\n.endm\n",
  479.   ".macro mtibatl\n mtspr 529+2*(\\1),\\2\n.endm\n",
  480.   ".macro mtdbatu\n mtspr 536+2*(\\1),\\2\n.endm\n",
  481.   ".macro mtdbatl\n mtspr 537+2*(\\1),\\2\n.endm\n",
  482.   ".macro mtdabr\n mtspr 1013,\\1\n.endm\n",
  483.   ".macro mfxer\n mfspr \\1,1\n.endm\n",
  484.   ".macro mflr\n mfspr \\1,8\n.endm\n",
  485.   ".macro mfctr\n mfspr \\1,9\n.endm\n",
  486.   ".macro mfdsisr\n mfspr \\1,18\n.endm\n",
  487.   ".macro mfdar\n mfspr \\1,19\n.endm\n",
  488.   ".macro mfdec\n mfspr 22,\\1\n.endm\n",
  489.   ".macro mfsdr1\n mfspr \\1,25\n.endm\n",
  490.   ".macro mfsrr0\n mfspr \\1,26\n.endm\n",
  491.   ".macro mfsrr1\n mfspr \\1,27\n.endm\n",
  492.   ".macro mfsprg\n mfspr \\1,272+(\\2)\n.endm\n",
  493.   ".macro mfasr\n mfspr \\1,280\n.endm\n",
  494.   ".macro mfear\n mfspr \\1,282\n.endm\n",
  495.   ".macro mftbl\n mftb \\1,268\n.endm\n",
  496.   ".macro mftbu\n mftb \\1,269\n.endm\n",
  497.   ".macro mfpvr\n mfspr \\1,287\n.endm\n",
  498.   ".macro mfibatu\n mfspr \\1,528+2*(\\2)\n.endm\n",
  499.   ".macro mfibatl\n mfspr \\1,529+2*(\\2)\n.endm\n",
  500.   ".macro mfdbatu\n mfspr \\1,536+2*(\\2)\n.endm\n",
  501.   ".macro mfdbatl\n mfspr \\1,537+2*(\\2)\n.endm\n",
  502.   ".macro mfdabr\n mfspr \\1,1013\n.endm\n",
  503.  
  504.   ".macro nop\n ori 0,0,0\n.endm\n",
  505.   ".macro li\n addi \\1,0,\\2\n.endm\n",
  506.   ".macro lis\n addis \\1,0,\\2\n.endm\n",
  507.   ".macro mr\n or \\1,\\2,\\2\n.endm\n",
  508.   ".macro mr.\n or. \\1,\\2,\\2\n.endm\n",
  509.   ".macro not\n nor \\1,\\2,\\2\n.endm\n",
  510.   ".macro not.\n nor. \\1,\\2,\\2\n.endm\n",
  511.   ".macro mtcr\n mtcrf 0xff,\\1\n.endm\n",
  512.   0
  513. };
  514.